/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package modele;


/**
 * @author Hadrien
 */

public class RERBook extends Order{
    public var reduceFare: Boolean = false on replace {computePrice()};
    public var startStation: String = "" on replace {computePrice()};
    public var endStation: String = "" on replace {computePrice()};
    override public var description = bind "{quantity} Carnet RER / {if (reduceFare) "Tarif réduit" else "Plein tarif"}\n{startStation}\n{endStation}";
    init {
        price = if (reduceFare) 60.0 else 120.0;
        name = "Paris region ticket book";
    }

    override public function deliver () : Void {
        for (i in [1..quantity]) {
            println("Print a {name} from {startStation} to {endStation} {if (reduceFare) "reduce fare" else "full fare"})");
        }
    }

    function computePrice() {
        price = if (reduceFare) 60.0 else 120.0;
    }

}
